<?php
/**
 * Manages  connection to database.
 *
 * @author dll_hell_2
 */
class dbConnection {
    protected $connection;
    protected $selected_db;
    protected $server = 'localhost';
    protected $user = 'root';
    protected $password = '';
    protected $database_name = 'school_rs';
    public function __construct() {
        $this->connection = mysql_connect($this->server,$this->user, $this->password)
                or die('Database connection failed!');
        $this->selected_db = mysql_select_db($this->database_name)
                or die('Database connection failed!');
    }
    public function db_query($query)
    {
        return @mysql_query($query);
    }
    public function __destruct() {
        @mysql_close($this->connection);
    }
}

?>
